<?php
$rs = [

    'autoload' => [
        'model' => [
            PATH_SITE . 'model/',
            PATH_COM . 'common/model/'
        ],
        'action' => [
            PATH_SITE . 'app/' . APP_NAME . '/action/',
            PATH_COM . 'common/action/' . APP_NAME . '/',
        ],
        'api' => [
            PATH_SITE . 'api/',
            PATH_COM . 'common/api/',
        ],
        'widget' => [
            PATH_SITE . 'widget/',
            PATH_COM . 'common/widget/',
        ]
    ],


    'server' => [
        // session
        'session' => function(){
            $options = array(
                'name' => 'zacms',
                'expire' => 1800,
                'handle' => 'memcached',
                'handleOptions' => array(
                    array(
                        'host' => '127.0.0.1',
                        'port' => 11211
                    )
                ),
            );
            return \sp\session\Session::getInstance($options);
        },

        // cache
        'cache' => function(){
            $options = array(
                'servers' => array(
                    array(
                        'persistent' => false,
                        'host' => '127.0.0.1',
                        'port' => 11211,
                    )
                ),
                'default_expire' => 3600 * 24
            );
            return \sp\cache\MCache::getInstance($options);
        },

        // database
        'adapter' => function() {
            static $adapter = null;
            if($adapter){
                return $adapter;
            }

            return \sp\db\AdapterFactory::product(array(
                'db' => array(
                    //'adapter' => 'Mysqli',
                    'host' => '127.0.0.1',
                    'port' => 3306,
                    'user' => 'root',
                    'password' => 'q123123',
                    'database' => 'doc',
                    'charset' => 'gbk',
                    'persitent' => false
                    ),
                'profiler' => service('dbprofiler')
            ));
        },

        'dbprofiler' => function(){
    //        return null;
            if(DEV_MODE || isset($_REQUEST['sqltest'])){
                return \sp\db\profiler\Profiler::getInstance();
            }else{
                return null;
            }
        },

    ]
];

return $rs;